<?php 
//get library
eval ("?>$library");
?>
  	            
            <div class="container">            	                
                <div class="row-fluid">

                    <!-- main content
                    ================================================== -->
                    <div id="mainContent" class="span8">
                        <div id="mainContent_inner">
                        
                        	<!-- archive
                    		================================================== -->
                            <h1><?=$articleTitle?></h1>
                            <hr />
                            <div class="archives">
                            	<?php 
                            	foreach ($articles as $key => $article) {
                            	?>
                                <article itemscope itemtype="http://schema.org/Article" itemprop="itemListElement">
                                    <h4 class="articleTitle" itemprop="name"><a href="/article/<?=$article->getAlias()?>"><?=$article->getTitle()?></a></h4>
                                    <div class="articleMeta clearafter">
                                    	<?php 
										$category = $categories[$article->getCategory()];
										$author = $authors[$article->getCreator()];
										if ($author === NULL) {
										?>
                                        <i class="icon-user"></i> <?=$article->getAuthorName()?>
                                        <?php 
										} else {
                                        ?>
                                        <a itemprop="author" href="/author/<?=$author->getId() ?>"><i class="icon-user"></i> <?=$author->getName()?> </a>
                                        <?php 
										}
                                        ?>
                                        
                                        | 
                                        <a href="/category/<?=$category === NULL ? "" : $category->getAlias() ?>"><i class="icon-folder-close"></i> <?=$category === NULL ? "" : $category->getName()?></a> 
                                        |
                                        <span itemprop="dateCreated"><i class="icon-calendar"></i> <?=date("M, d Y", $article->getCreated())?></span>                                    
                                        <meta content="UserComments:5" itemprop="interactionCount">
                                    </div>                                
                                </article>
                                <?php 
                            	}
                                ?>
                            </div>
                        </div>
                    </div>

                    <!-- sidebar
                    ================================================== -->
                    <div class="span4">
                        <aside>
                        
                        	<!-- Search
        					================================================== -->
                        	<div class="module-2">
                                <h3 class="title">Search this site</h3>
                                <div class="moduleContent">
                                    <form method="get" action="/search" class="form-inline">
                                    	<input type="text" placeholder="Search article" class="" name="q"  />
                                        <button type="submit" class="btn">Search</button>
                                    </form>
                                </div>
                            </div>
                            
                            <!-- Adv
        					================================================== -->
                            <div class="module-2">                                
                                <div class="moduleContent adv-sidebar">
                                	<?=$ads->getAds300x250()?>
                                </div>
                            </div>
                            
                            <!-- date archives
        					================================================== -->
                            <div class="module-6">
                            	
                            	<h3 class="title">Archives</h3>
                                <div class="moduleContent">
									<h4 class="lead"><?=$year ?></h4>
                                    <ul class="listingStyle">
                                    	<?php 
                                    	for ($i = 0; $i < $countMonth + 1; $i++) {
                                    	?>
                                        <li><a href="/archives/<?=$month < 10 ? "0" . $month : $month ?>-<?=$year?>"><?=date("F", mktime(0, 0, 0, $month, 10));?>&nbsp;<?=$year?></a></li>
                                        <?php 
                                        	$month -= 1;
				                			if ($month <= 0) {
				                				$month = 12;
				                				$year -= 1;
				                			}
                                    	}
                                    	?>
                                    </ul>
                                </div>
                            </div>
                            
                            <!-- Recent article
        					================================================== -->
                            <div class="module-6">
                                <h3 class="title">Recent article view</h3>
                                <div class="moduleContent">
                                    <ul class="listingStyle" itemscope itemtype="http://schema.org/ItemList">
                                    	<?php 
                                    	foreach ($lastestArticles as $key => $article) {
                                    	?>
                                    	<li itemscope itemtype="http://schema.org/Article" itemprop="itemListElement">
                                        	<h5 itemprop="name" class="articleTitle"><a href="/article/<?=$article->getAlias()?>" itemprop="url"><?=$article->getTitle()?></a></h5>
                                            <span itemprop="dateCreated"><?=date("M, d Y", $article->getCreated())?></span>
                                        </li>
                                        <?php 
                                    	}
                                        ?>
                                    </ul>
                                </div>
                            </div>
                            
                            <!-- Categories
        					================================================== -->
                            <div class="module-6">
                                <h3 class="title">Categories</h3>
                                <div class="moduleContent">
                                    <ul class="listingStyle" itemscope itemtype="http://schema.org/ItemList">
                                    	<?php
                                    	foreach ($lstCategories as $key => $category) { 
                                    	?>
                                    	<li itemprop="itemListElement"><i class="icon-share-alt"></i> <a itemprop="url" href="/category/<?=$category->getAlias()?>"><span itemprop="name"><?=$category->getName()?></span></a></li>
                                    	<?php } ?>
                                    </ul>
                                </div>
                            </div>
                            
                            <!-- Tags
        					================================================== -->
                            <div class="module-2">
                            	<h3 class="title">Tags</h3>                            
                                <div class="moduleContent" itemscope itemtype="http://schema.org/CreativeWork">
                                	<?php 
                                	foreach ($tags as $key => $tag) {
                                	?>
                                    <a href="/tag/<?=urlencode($tag)?>" class="label label-info" itemprop="keywords"><?=$tag?></a>
                                    <?php 
                                	}
                                    ?>
                                </div>
                            </div>
                        </aside>
                    </div>                                               
                </div>
            </div>